package 面向对象中级.课堂练习.Exercise04;

public class Student extends Person{
    /**
     * （2）声明子类：Student类，继承Person类
     * 新增属性：score成绩，属性私有化，
     * 包含get/set方法
     * 重写getInfo()方法：例如：姓名：张三，年龄：23，性别：男，成绩：89
     */
    private int score;

    public Student(int score) {
        this.score = score;
    }

    public Student(String name, int age, char gender, int score) {
        super(name, age, gender);
        this.score = score;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    public void getInfo() {
        System.out.println("姓名："+getName()+" "+"年龄："+getAge()+" " +"性别："+getGender()+" "+"成绩："+getScore()+" ");
    }
}
